home *** CD-ROM | disk | FTP | other *** search
- '************************************************************************
- ' Window Driver Routines
- ' Written By Kyle Sparks, Microsoft, 1988
- '
- 'for use inside the QB4 environment, must have QB.QLB Quick Library loaded
- '
- '************************************************************************
-
- DEFINT A-Z
-
- '----------------------------- Define Types -----------------------------
-
- TYPE RegType 'Type for use with Interrupt
- AX AS INTEGER
- BX AS INTEGER
- CX AS INTEGER
- DX AS INTEGER
- BP AS INTEGER
- SI AS INTEGER
- DI AS INTEGER
- FLAGS AS INTEGER
- DS AS INTEGER
- ES AS INTEGER
- END TYPE
-
- '-------------------------- Declare Procedures --------------------------
-
- DECLARE FUNCTION SetVideoSegment ()
- DECLARE SUB GetVideoMode (VidMode)
- DECLARE SUB KillWindow (XStart, YStart, DeltaX, DeltaY, WindowMemory$)
- DECLARE SUB MakeWindow (XStart, YStart, DeltaX, DeltaY, ForeColor, BackColor, Border, WindowMemory$)
- DECLARE SUB ScrollUp (AL, BH, CH, CL, DH, DL)
- DECLARE SUB ScrollDown (AL, BH, CH, CL, DH, DL)
-
- DECLARE SUB INTERRUPT (IntNo%, InRegs AS RegType, OutRegs AS RegType)
- DECLARE SUB InterruptX (IntNo%, InRegs AS RegType, OutRegs AS RegType)
-
- '------------------------------------------------------------------------
-
- SUB GetVideoMode (VidMode)
- '------------------------------------------------------------------------
- ' procedure GetVideoMode returns the current video mode in VidMode.
- '------------------------------------------------------------------------
-
- DIM regs AS RegType
- regs.AX = (&HF * 256) + 0
- INTERRUPT &H10, regs, regs
- VidMode = (regs.AX MOD 256)
-
- END SUB
-
- SUB KillWindow (XStart, YStart, DeltaX, DeltaY, WindowMemory$)
- '------------------------------------------------------------------------
- ' procedure KillWindow removes a popup window made by MakeWindow
- '------------------------------------------------------------------------
-
- DelX = DeltaX - 1
- DelY = DeltaY - 1
-
- 'Restore Screen
-
- CALL ScrRstr(WindowMemory$)
-
- END SUB
-
- SUB MakeWindow (XStart, YStart, DeltaX, DeltaY, ForeColor, BackColor, Border, WindowMemory$)
- '------------------------------------------------------------------------
- ' procedure MakeWindow stores a specified portion of the screen in a
- ' buffer, then makes a window with a border of the specified style and
- ' color.
- '------------------------------------------------------------------------
-
- IF Border = 1 THEN
- UpLeft$ = CHR$(218)
- LowLeft$ = CHR$(192)
- UpRight$ = CHR$(191)
- LowRight$ = CHR$(217)
- Horiz$ = CHR$(196)
- Vert$ = CHR$(179)
- ELSE
- UpLeft$ = CHR$(201)
- LowLeft$ = CHR$(200)
- UpRight$ = CHR$(187)
- LowRight$ = CHR$(188)
- Horiz$ = CHR$(205)
- Vert$ = CHR$(186)
- END IF
-
- WindowMemory$ = SPACE$(4000)
-
- l& = FRE("")
-
- DelX = DeltaX - 1
- DelY = DeltaY - 1
-
- CALL ScrSave(WindowMemory$)
-
- 'Make window
-
- CT = 0
- LOCATE YStart + CT, XStart: COLOR BackColor, ForeColor: PRINT UpLeft$; STRING$(1 + (DelX - 2), Horiz$); UpRight$; : COLOR ForeColor, BackColor: CT = CT + 1
- FOR PP = 1 TO DelY - 1
- LOCATE YStart + CT, XStart: COLOR BackColor, ForeColor: PRINT Vert$; : COLOR ForeColor, BackColor: PRINT STRING$(1 + (DelX - 2), " "); : COLOR BackColor, ForeColor: PRINT Vert$; : COLOR ForeColor, BackColor: CT = CT + 1
- NEXT PP
- LOCATE YStart + CT, XStart: COLOR BackColor, ForeColor: PRINT LowLeft$; STRING$(1 + (DelX - 2), Horiz$); LowRight$; : COLOR ForeColor, BackColor
-
- END SUB
-
- SUB ScrollDown (AL, BH, CH, CL, DH, DL)
- '------------------------------------------------------------------------
- ' procedure ScrollDown scrolls the designated area of the screen down.
- '
- ' AL - Number of lines to scoll window
- ' BH - Number of color attribute to be used for blanked area
- ' CH - Y coordinate of upper left corner of window to be scrolled
- ' CL - X coordinate of upper left corner of window to be scrolled
- ' DH - Y coordinate of lower right corner of window to be scrolled
- ' DL - X coordinate of lower right corner of window to be scrolled
- '------------------------------------------------------------------------
-
- CH = CH - 1
- CL = CL - 1
- DH = DH - 1
- DL = DL - 1
- DIM regs AS RegType
- regs.AX = (256 * &H7) + AL
- regs.BX = (256 * BH)
- regs.CX = (256 * CH) + CL
- regs.DX = (256 * DH) + DL
- INTERRUPT &H10, regs, regs
- END SUB
-
- SUB ScrollUp (AL, BH, CH, CL, DH, DL)
- '------------------------------------------------------------------------
- ' procedure ScrollDown scrolls the designated area of the screen down.
- '
- ' AL - Number of lines to scoll window
- ' BH - Number of color attribute to be used for blanked area
- ' CH - Y coordinate of upper left corner of window to be scrolled
- ' CL - X coordinate of upper left corner of window to be scrolled
- ' DH - Y coordinate of lower right corner of window to be scrolled
- ' DL - X coordinate of lower right corner of window to be scrolled
- '------------------------------------------------------------------------
-
- CH = CH - 1
- CL = CL - 1
- DH = DH - 1
- DL = DL - 1
- DIM regs AS RegType
- regs.AX = (256 * &H6) + AL
- regs.BX = (256 * BH)
- regs.CX = (256 * CH) + CL
- regs.DX = (256 * DH) + DL
- INTERRUPT &H10, regs, regs
- END SUB
-
- FUNCTION SetVideoSegment
-
- DEF SEG = 0
-
- SELECT CASE PEEK(&H449) 'Figure out what video mode is being used
- CASE 0 TO 3
- DEF SEG = &HB800 'CGA and EGA text modes
- CASE 7
- DEF SEG = &HB000 'Monochrome text mode
- CASE ELSE
- CLS 'Not a text mode, or not a compatible card
- SetVideoSegment = &HFF
- EXIT FUNCTION
- END SELECT
-
- END FUNCTION
-
-